import Vue from 'vue'
import Router from 'vue-router'
import View from "@/components/View";
import Record from "@/components/Record";
import MainPage from "@/components/MainPage";
import VConsole from 'vconsole/dist/vconsole.min.js' //import vconsole
let vConsole = new VConsole() // 初始化

Vue.use(Router)
Vue.use(vConsole)

Vue.prototype.viewCookies1=['yesterday','week','month','season','year']
Vue.prototype.viewCookies2=[ 'lately7Day', 'lately6Month']


//刷新页面报错  重复点击导航时，控制台出现报错 ，虽然不影响功能使用，但也不能视而不见。
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}

export default new Router({
    routes: [
        {
            path: '/mainPage',
            component: MainPage,
            meta: {
                keepAlive: true, // 是否缓存
                scollTopPosition: 0 // 滚动条位置
            }
        },
        {
            path:'/record',
            component:Record
        },
        {
            path: '/view',
            component: View
        }


    ]
})
